package o;

import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Renderer;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.util.PriorityTaskManager;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsUtil;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;

public class aax implements abi {
    private final boolean ʻ;
    private final int ʼ;
    private final long ʽ;
    private final long ˊ;
    private final long ˋ;
    private boolean ˋॱ;
    private final ali ˎ;
    private final long ˏ;
    private int ͺ;
    private final long ॱ;
    private final boolean ॱॱ;
    private final PriorityTaskManager ᐝ;

    public aax() {
        this(new ali(true, WXMediaMessage.THUMB_LENGTH_LIMIT));
    }

    @Deprecated
    public aax(ali o_ali) {
        this(o_ali, DnsUtil.MAX_DNS_TIMEOUT, 50000, 2500, 5000, -1, true);
    }

    @Deprecated
    public aax(ali o_ali, int i, int i2, int i3, int i4, int i5, boolean z) {
        this(o_ali, i, i2, i3, i4, i5, z, null);
    }

    @Deprecated
    public aax(ali o_ali, int i, int i2, int i3, int i4, int i5, boolean z, PriorityTaskManager priorityTaskManager) {
        this(o_ali, i, i2, i3, i4, i5, z, priorityTaskManager, 0, false);
    }

    protected aax(ali o_ali, int i, int i2, int i3, int i4, int i5, boolean z, PriorityTaskManager priorityTaskManager, int i6, boolean z2) {
        ˏ(i3, 0, "bufferForPlaybackMs", "0");
        ˏ(i4, 0, "bufferForPlaybackAfterRebufferMs", "0");
        ˏ(i, i3, "minBufferMs", "bufferForPlaybackMs");
        ˏ(i, i4, "minBufferMs", "bufferForPlaybackAfterRebufferMs");
        ˏ(i2, i, "maxBufferMs", "minBufferMs");
        ˏ(i6, 0, "backBufferDurationMs", "0");
        this.ˎ = o_ali;
        this.ˏ = C.ˏ((long) i);
        this.ˊ = C.ˏ((long) i2);
        this.ˋ = C.ˏ((long) i3);
        this.ॱ = C.ˏ((long) i4);
        this.ʼ = i5;
        this.ʻ = z;
        this.ᐝ = priorityTaskManager;
        this.ʽ = C.ˏ((long) i6);
        this.ॱॱ = z2;
    }

    public void ˏ() {
        ˎ(false);
    }

    public void ॱ(Renderer[] rendererArr, TrackGroupArray trackGroupArray, akx o_akx) {
        this.ͺ = this.ʼ == -1 ? ॱ(rendererArr, o_akx) : this.ʼ;
        this.ˎ.ˊ(this.ͺ);
    }

    public void ˋ() {
        ˎ(true);
    }

    public void ˊ() {
        ˎ(true);
    }

    public alc ˎ() {
        return this.ˎ;
    }

    public long ॱ() {
        return this.ʽ;
    }

    public boolean ʽ() {
        return this.ॱॱ;
    }

    public boolean ˏ(long j, float f) {
        boolean z = true;
        boolean z2 = this.ˎ.ˎ() >= this.ͺ;
        boolean z3 = this.ˋॱ;
        long j2 = this.ˏ;
        if (f > 1.0f) {
            j2 = Math.min(anr.ˏ(j2, f), this.ˊ);
        }
        if (j < j2) {
            if (!this.ʻ && z2) {
                z = false;
            }
            this.ˋॱ = z;
        } else if (j >= this.ˊ || z2) {
            this.ˋॱ = false;
        }
        if (!(this.ᐝ == null || this.ˋॱ == z3)) {
            if (this.ˋॱ) {
                this.ᐝ.ॱ(0);
            } else {
                this.ᐝ.ˏ(0);
            }
        }
        return this.ˋॱ;
    }

    public boolean ˏ(long j, float f, boolean z) {
        long ˊ = anr.ˊ(j, f);
        long j2 = z ? this.ॱ : this.ˋ;
        return j2 <= 0 || ˊ >= j2 || (!this.ʻ && this.ˎ.ˎ() >= this.ͺ);
    }

    protected int ॱ(Renderer[] rendererArr, akx o_akx) {
        int i = 0;
        int i2 = 0;
        while (i < rendererArr.length) {
            if (o_akx.ˊ(i) != null) {
                i2 += anr.ᐝ(rendererArr[i].f_());
            }
            i++;
        }
        return i2;
    }

    private void ˎ(boolean z) {
        this.ͺ = 0;
        if (this.ᐝ != null && this.ˋॱ) {
            this.ᐝ.ˏ(0);
        }
        this.ˋॱ = false;
        if (z) {
            this.ˎ.ॱ();
        }
    }

    private static void ˏ(int i, int i2, String str, String str2) {
        amm.ˊ(i >= i2, str + " cannot be less than " + str2);
    }
}
